<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Vision,Halcon,">










<meta name="description" content="1.Access (取出)1.1 get_grayval — Access the gray values of an image object. get_grayval(Image : : Row, Column : Grayval)獲取圖像中一點的灰度值1.2 get_grayval_contour_xld — Return gray values of an image at the pos">
<meta name="keywords" content="Vision,Halcon">
<meta property="og:type" content="article">
<meta property="og:title" content="Halcon算子學習——image">
<meta property="og:url" content="http://www.soshare.cn/2013/04/07/130407-halcon-image/index.html">
<meta property="og:site_name" content="soshare">
<meta property="og:description" content="1.Access (取出)1.1 get_grayval — Access the gray values of an image object. get_grayval(Image : : Row, Column : Grayval)獲取圖像中一點的灰度值1.2 get_grayval_contour_xld — Return gray values of an image at the pos">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2019-10-13T09:20:02.644Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Halcon算子學習——image">
<meta name="twitter:description" content="1.Access (取出)1.1 get_grayval — Access the gray values of an image object. get_grayval(Image : : Row, Column : Grayval)獲取圖像中一點的灰度值1.2 get_grayval_contour_xld — Return gray values of an image at the pos">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"right","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://www.soshare.cn/2013/04/07/130407-halcon-image/">



<script data-ad-client="ca-pub-3578624407535320" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>


  <title>Halcon算子學習——image | soshare</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">soshare</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">分享</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-file">
          <a href="http://taosha126.ys168.com" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-file"></i> <br>
            
            File
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>
            
            Commonweal 404
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            Search
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="Searching..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>


 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://www.soshare.cn/2013/04/07/130407-halcon-image/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="tosobright">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="soshare">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">Halcon算子學習——image</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2013-04-07T17:16:44+08:00">
                2013-04-07
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Program/" itemprop="url" rel="index">
                    <span itemprop="name">Program</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2013/04/07/130407-halcon-image/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2013/04/07/130407-halcon-image/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2013/04/07/130407-halcon-image/" class="leancloud_visitors" data-flag-title="Halcon算子學習——image">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">Visitors&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>1.Access (取出)<br>1.1 get_grayval — Access the gray values of an image object.</p>
<p>get_grayval(Image : : Row, Column : Grayval)<br>獲取圖像中一點的灰度值<br>1.2 get_grayval_contour_xld — Return gray values of an image at the positions of an XLD contour.</p>
<p>get_grayval_contour_xld(Image, Contour : : Interpolation : Grayval)<br>返回一張圖中 XLD 輪廓位置的灰度值（需要先行生成 XLD）<br>XLD(eXtended Line Description 的縮寫)<br>Interpolation（插補）：nearest_neighbor、bilinear、bicubic 和 bicubic_clipped<br>1.3 get_grayval_interpolated — Return gray values of an image at the positions given by tuples of rows and columns.</p>
<p>get_grayval_interpolated(Image : : Row, Column, Interpolation : Grayval)<br>返回一張圖中給定的行列數組位置的灰度值（無需生成 XLD）<br>1.4 get_image_pointer1 — Access the pointer of a channel.</p>
<p>get_image_pointer1(Image : : : Pointer, Type, Width, Height)<br>返回圖像第一通道的指針。<br>1.5 get_image_pointer1_rect — Access to the image data pointer and the image data inside the smallest rectangle of the domain of the input image.</p>
<p>get_image_pointer1_rect(Image : : : PixelPointer, Width, Height, VerticalPitch, HorizontalBitPitch, BitsPerPixel)<br>獲取圖像矩形域的指針<br>1.6 get_image_pointer3 — Access the pointers of a colored image.</p>
<p>get_image_pointer3(ImageRGB : : : PointerRed, PointerGreen, PointerBlue, Type, Width, Height)<br>獲取彩色圖像的指針<br>1.7 get_image_size — Return the size of an image.</p>
<p>get_image_size(Image : : : Width, Height)<br>獲取圖像 size<br>1.8 get_image_time — Request time at which the image was created.</p>
<p>get_image_time(Image : : : MSecond, Second, Minute, Hour, Day, YDay, Month, Year)<br>獲取圖像生成時間<br>1.9 get_image_type — Return the type of an image.</p>
<p>get_image_type(Image : : : Type)<br>獲取圖像類型</p>
<p>2.Acquisition（抓取）<br>2.1 close_all_framegrabbers — Close all image acquisition devices.</p>
<p>close_all_framegrabbers( : : : )<br>關閉所有圖像獲取設備<br>2.2 close_framegrabber — Close specified image acquisition device.</p>
<p>close_framegrabber( : : AcqHandle : )<br>關閉指定圖像獲取設備<br>2.3 get_framegrabber_callback — Query callback function of an image acquisition device.</p>
<p>get_framegrabber_callback( : : AcqHandle, CallbackType : CallbackFunction, UserContext)<br>查詢圖像獲取設備的囘調函數<br>2.4 get_framegrabber_lut — Query look-up table of the image acquisition device.</p>
<p>get_framegrabber_lut( : : AcqHandle : ImageRed, ImageGreen, ImageBlue)<br>查詢圖像獲取設備的查找表。<br>2.5 get_framegrabber_param — Query specific parameters of an image acquisition device.</p>
<p>get_framegrabber_param( : : AcqHandle, Param : Value)<br>查詢圖像獲取設備的指定參數<br>2.6 grab_data — Synchronous grab of images and preprocessed image data from the specified image acquisition device.</p>
<p>grab_data( : Image, Region, Contours : AcqHandle : Data)<br>2.7 grab_data_async — Asynchronous grab of images and preprocessed image data from the specified image acquisition device.</p>
<p>grab_data_async( : Image, Region, Contours : AcqHandle, MaxDelay : Data)<br>2.8 grab_image — Synchronous grab of an image from the specified image acquisition device.</p>
<p>grab_image( : Image : AcqHandle : )<br>2.9 grab_image_async — Asynchronous grab of an image from the specified image acquisition device.</p>
<p>grab_image_async( : Image : AcqHandle, MaxDelay : )<br>2.10 grab_image_start — Start an asynchronous grab from the specified image acquisition device.</p>
<p>grab_image_start( : : AcqHandle, MaxDelay : )<br>2.11 info_framegrabber — Query information about the specified image acquisition interface.</p>
<p>info_framegrabber( : : Name, Query : Information, ValueList)<br>2.12 open_framegrabber — Open and configure an image acquisition device.</p>
<p>open_framegrabber( : : Name, HorizontalResolution, VerticalResolution, ImageWidth, ImageHeight, StartRow, StartColumn, Field, BitsPerChannel, ColorSpace, Generic, ExternalTrigger, CameraType, Device, Port, LineIn : AcqHandle)<br>2.13 set_framegrabber_callback — Register a callback function for an image acquisition device.</p>
<p>set_framegrabber_callback( : : AcqHandle, CallbackType, CallbackFunction, UserContext : )<br>2.14 set_framegrabber_lut — Set look-up table of the image acquisition device.</p>
<p>set_framegrabber_lut( : : AcqHandle, ImageRed, ImageGreen, ImageBlue : )<br>2.15 set_framegrabber_param — Set specific parameters of an image acquistion device.</p>
<p>set_framegrabber_param( : : AcqHandle, Param, Value : )<br>3.Channel（通道）<br>3.1 access_channel — Access a channel of a multichannel image.</p>
<p>access_channel(MultiChannelImage : Image : Channel : )<br>取出一張多通道圖像中的一個通道<br>3.2 append_channel — Append additional matrices (channels) to the image.</p>
<p>append_channel(MultiChannelImage, Image : ImageExtended : : )<br>追加通道到圖像<br>3.3 channels_to_image — Convert one-channel images into a multichannel image</p>
<p>channels_to_image(Images : MultiChannelImage : : )<br>將多個單通道圖像轉化為一個多通道圖像<br>3.4 compose2 — Convert two images into a two-channel image.</p>
<p>compose2(Image1, Image2 : MultiChannelImage : : )<br>將兩張圖像轉化到一個雙通道圖像<br>3.5 compose3 — Convert 3 images into a three-channel image.</p>
<p>compose3(Image1, Image2, Image3 : MultiChannelImage : : )<br>將三張圖轉化為一個 3 通道圖<br>3.6 compose4 — Convert 4 images into a four-channel image.</p>
<p>compose4(Image1, Image2, Image3, Image4 : MultiChannelImage : : )<br>3.7 compose5 — Convert 5 images into a five-channel image.</p>
<p>compose5(Image1, Image2, Image3, Image4, Image5 : MultiChannelImage : : )<br>3.8 compose6 — Convert 6 images into a six-channel image.</p>
<p>compose6(Image1, Image2, Image3, Image4, Image5, Image6 : MultiChannelImage : : )<br>3.9 compose7 — Convert 7 images into a seven-channel image.</p>
<p>compose7(Image1, Image2, Image3, Image4, Image5, Image6, Image7 : MultiChannelImage : : )<br>3.10 count_channels — Count channels of image.</p>
<p>count_channels(MultiChannelImage : : : Channels)<br>計算出圖像的通道數<br>3.11 decompose2 — Convert a two-channel image into two images.</p>
<p>decompose2(MultiChannelImage : Image1, Image2 : : )<br>將一個雙通道圖像轉化為兩張圖像<br>3.12 decompose3 — Convert a three-channel image into three images.</p>
<p>decompose3(MultiChannelImage : Image1, Image2, Image3 : : )<br>3.13 decompose4 — Convert a four-channel image into four images.</p>
<p>decompose4(MultiChannelImage : Image1, Image2, Image3, Image4 : : )<br>3.14 decompose5 — Convert a five-channel image into five images.</p>
<p>decompose5(MultiChannelImage : Image1, Image2, Image3, Image4, Image5 : : )</p>
<p>3.15 decompose6 — Convert a six-channel image into six images.</p>
<p>decompose6(MultiChannelImage : Image1, Image2, Image3, Image4, Image5, Image6 : : )<br>3.16 decompose7 — Convert a seven-channel image into seven images.</p>
<p>decompose7(MultiChannelImage : Image1, Image2, Image3, Image4, Image5, Image6, Image7 : : )<br>3.17 image_to_channels — Convert a multichannel image into One-channel images</p>
<p>image_to_channels(MultiChannelImage : Images : : )<br>將一個多通道圖像轉化為單通道圖像數組<br>4.Creation（創立，生成）<br>4.1 copy_image — Copy an image and allocate new memory for it.</p>
<p>copy_image(Image : DupImage : : )<br>將一張圖像拷貝到新內存<br>4.2 gen_image1 — Create an image from a pointer to the pixels.</p>
<p>gen_image1( : Image : Type, Width, Height, PixelPointer : )<br>從像素指針生成圖像<br>4.3 gen_image1_extern — Create an image from a pointer on the pixels with storage management.</p>
<p>gen_image1_extern( : Image : Type, Width, Height, PixelPointer, ClearProc : )<br>4.4 gen_image1_rect — Create an image with a rectangular domain from a pointer on the pixels (with storage management).</p>
<p>gen_image1_rect( : Image : PixelPointer, Width, Height, VerticalPitch, HorizontalBitPitch, BitsPerPixel, DoCopy, ClearProc : )<br>4.5 gen_image3 — Create an image from three pointers to the pixels (red/green/blue).</p>
<p>gen_image3( : ImageRGB : Type, Width, Height, PixelPointerRed, PixelPointerGreen, PixelPointerBlue : )<br>4.6 gen_image3_extern — Create a three-channel image from three pointers on the pixels with storage management.</p>
<p>gen_image3_extern( : Image : Type, Width, Height, PointerRed, PointerGreen, PointerBlue, ClearProc : )<br>4.7 gen_image_const — Create an image with constant gray value.</p>
<p>gen_image_const( : Image : Type, Width, Height : )<br>以一個灰度常量創建圖像<br>4.8 gen_image_gray_ramp — Create a gray value ramp.</p>
<p>gen_image_gray_ramp( : ImageGrayRamp : Alpha, Beta, Mean, Row, Column, Width, Height : )<br>創建一個灰度斜面圖像</p>
<p>4.9 gen_image_interleaved — Create a three-channel image from a pointer to the interleaved pixels.</p>
<p>gen_image_interleaved( : ImageRGB : PixelPointer, ColorFormat, OriginalWidth, OriginalHeight, Alignment, Type, ImageWidth, ImageHeight, StartRow, StartColumn, BitsPerChannel, BitShift : )<br>4.10 gen_image_proto — Create an image with a specified constant gray value.</p>
<p>gen_image_proto(Image : ImageCleared : Grayval : )<br>以一個灰度值創建圖像，圖像 size 源於輸入參數 Image<br>4.11 gen_image_surface_first_order — Create a tilted gray surface with first order polynomial.</p>
<p>gen_image_surface_first_order( : ImageSurface : Type, Alpha, Beta, Gamma, Row, Col, Width, Height : )<br>4.12 gen_image_surface_second_order — Create a curved gray surface with second order polynomial.</p>
<p>gen_image_surface_second_order( : ImageSurface : Type, Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Row, Col, Width, Height : )<br>4.13 region_to_bin — Convert a region into a binary byte-image.</p>
<p>region_to_bin(Region : BinImage : ForegroundGray, BackgroundGray, Width, Height : )<br>4.14 region_to_label — Convert regions to a label image.</p>
<p>region_to_label(Region : ImageLabel : Type, Width, Height : )<br>4.15 region_to_mean — Paint regions with their average gray value.</p>
<p>region_to_mean(Regions, Image : ImageMean : : )<br>5.Domain（範圍）<br>5.1 add_channels — Add gray values to regions.</p>
<p>add_channels(Regions, Image : GrayRegions : : )<br>添加灰度值到 region 區域<br>5.2 change_domain — Change definition domain of an image.</p>
<p>change_domain(Image, NewDomain : ImageNew : : )<br>改變圖像的定義範圍<br>5.3 full_domain — Expand the domain of an image to maximum.</p>
<p>full_domain(Image : ImageFull : : )<br>擴散圖像範圍<br>5.4 get_domain — Get the domain of an image.</p>
<p>get_domain(Image : Domain : : )<br>獲取圖像範圍<br>5.5 rectangle1_domain — Reduce the domain of an image to a rectangle.</p>
<p>rectangle1_domain(Image : ImageReduced : Row1, Column1, Row2, Column2 : )<br>去除圖像的方形範圍<br>5.6 reduce_domain — Reduce the domain of an image.</p>
<p>reduce_domain(Image, Region : ImageReduced : : )<br>去除圖像範圍<br>6.Features（特徵）</p>
<p>6.1 area_center_gray — Compute the area and center of gravity of a region in a gray value image.</p>
<p>area_center_gray(Regions, Image : : : Area, Row, Column)<br>計算灰度圖像中 region 的面積和中心點<br>6.2 cooc_feature_image — Calculate a co-occurrence matrix and derive gray value features thereof.</p>
<p>cooc_feature_image(Regions, Image : : LdGray, Direction : Energy, Correlation, Homogeneity, Contrast)<br>計算一個同時出現的矩陣并得出相關灰度值特徵。<br>6.3 cooc_feature_matrix — Calculate gray value features from a co-occurrence matrix.</p>
<p>cooc_feature_matrix(CoocMatrix : : : Energy, Correlation, Homogeneity, Contrast)<br>從一個同時出現的矩陣計算灰度值特徵<br>6.4 elliptic_axis_gray — Compute the orientation and major axes of a region in a gray value image.</p>
<p>elliptic_axis_gray(Regions, Image : : : Ra, Rb, Phi)<br>在一個灰度值圖像中計算一個區域的方位和主軸。<br>6.5 entropy_gray — Determine the entropy and anisotropy of images.</p>
<p>entropy_gray(Regions, Image : : : Entropy, Anisotropy)<br>確定一個圖像的熵和各向異性。<br>6.6 estimate_noise — Estimate the image noise from a single image.</p>
<p>estimate_noise(Image : : Method, Percent : Sigma)<br>從一個單一圖像估計圖像噪聲<br>6.7 fit_surface_first_order — Calculate gray value moments and approximation by a first order surface (plane).</p>
<p>fit_surface_first_order(Regions, Image : : Algorithm, Iterations, ClippingFactor : Alpha, Beta, Gamma)<br>通過一個一階表面（平面）計算灰度值力矩和近似值。<br>6.8 fit_surface_second_order — Calculate gray value moments and approximation by a second order surface.</p>
<p>fit_surface_second_order(Regions, Image : : Algorithm, Iterations, ClippingFactor : Alpha, Beta, Gamma, Delta, Epsilon, Zeta)<br>通過一個二階表面（平面）計算灰度值力矩和近似值。<br>6.9 fuzzy_entropy — Determine the fuzzy entropy of regions.</p>
<p>fuzzy_entropy(Regions, Image : : Apar, Cpar : Entropy)<br>確定區域的模糊熵<br>6.10 fuzzy_perimeter — Calculate the fuzzy perimeter of a region.</p>
<p>fuzzy_perimeter(Regions, Image : : Apar, Cpar : Perimeter)<br>計算一個區域的模糊周長<br>6.11 gen_cooc_matrix — Calculate the co-occurrence matrix of a region in an image.</p>
<p>gen_cooc_matrix(Regions, Image : Matrix : LdGray, Direction : )<br>在一個圖像中計算一個區域中同時出現的矩陣<br>6.12 gray_features — Calculates gray value features for a set of regions.</p>
<p>gray_features(Regions, Image : : Features : Value)<br>計算一個設置區域的灰度值特徵<br>6.13 gray_histo — Calculate the gray value distribution.</p>
<p>gray_histo(Regions, Image : : : AbsoluteHisto, RelativeHisto)<br>計算灰度值分佈<br>6.14 gray_histo_abs — Calculate the gray value distribution.</p>
<p>gray_histo_abs(Regions, Image : : Quantization : AbsoluteHisto)<br>計算灰度值分佈<br>6.15 gray_histo_range — Calculate the gray value distribution of a single channel image within a certain gray value range.</p>
<p>gray_histo_range(Regions, Image : : Min, Max, NumBins : Histo, BinSize)<br>計算一個單通道圖像在一定灰度值範圍內的灰度值分佈<br>6.16 gray_projections — Calculate horizontal and vertical gray-value projections.</p>
<p>gray_projections(Region, Image : : Mode : HorProjection, VertProjection)<br>計算水平和垂直灰度值預測<br>6.17 histo_2dim — Calculate the histogram of two-channel gray value images.</p>
<p>histo_2dim(Regions, ImageCol, ImageRow : Histo2Dim : : )<br>計算兩通道灰度值圖像的直方圖<br>6.18 intensity — Calculate the mean and deviation of gray values.</p>
<p>intensity(Regions, Image : : : Mean, Deviation)<br>計算灰度值的平均值和偏差<br>6.19 min_max_gray — Determine the minimum and maximum gray values within regions.</p>
<p>min_max_gray(Regions, Image : : Percent : Min, Max, Range)<br>計算區域內的最大和最小灰度值<br>6.20 moments_gray_plane — Calculate gray value moments and approximation by a plane.</p>
<p>moments_gray_plane(Regions, Image : : : MRow, MCol, Alpha, Beta, Mean)<br>通過一個平面計算灰度值力矩和近似值<br>6.21 plane_deviation — Calculate the deviation of the gray values from the approximating image plane.</p>
<p>plane_deviation(Regions, Image : : : Deviation)<br>從近似像平面計算灰度值的偏差<br>6.22 select_gray — Select regions based on gray value features.</p>
<p>select_gray(Regions, Image : SelectedRegions : Features, Operation, Min, Max : )<br>基於灰度值特徵選擇區域<br>6.23 shape_histo_all — Determine a histogram of features along all threshold values.</p>
<p>shape_histo_all(Region, Image : : Feature : AbsoluteHisto, RelativeHisto)<br>通過閾值確定一個特徵直方圖<br>6.24 shape_histo_point — Determine a histogram of features along all threshold values.</p>
<p>shape_histo_point(Region, Image : : Feature, Row, Column : AbsoluteHisto, RelativeHisto)<br>通過閾值確定一個特徵直方圖<br>7.Format（格式）<br>7.1 change_format — Change image size.</p>
<p>change_format(Image : ImagePart : Width, Height : )<br>改變圖像的 size<br>7.2 crop_domain — Cut out of defined gray values.</p>
<p>crop_domain(Image : ImagePart : : )<br>去除指定的灰度值<br>7.3 crop_domain_rel — Cut out an image area relative to the domain.</p>
<p>crop_domain_rel(Image : ImagePart : Top, Left, Bottom, Right : )<br>去除和定義域有關的圖像區域<br>7.4 crop_part — Cut out a rectangular image area.</p>
<p>crop_part(Image : ImagePart : Row, Column, Width, Height : )<br>去除一個矩形圖像區域<br>7.5 crop_rectangle1 — Cut out a rectangular image area.</p>
<p>crop_rectangle1(Image : ImagePart : Row1, Column1, Row2, Column2 : )<br>去除一個矩形圖像區域（矩形的選擇與 crop_part 不同）<br>7.6 tile_channels — Tile multiple images into a large image.</p>
<p>tile_channels(Image : TiledImage : NumColumns, TileOrder : )<br>把多重圖像拼成一個大圖像<br>7.7 tile_images — Tile multiple image objects into a large image.</p>
<p>tile_images(Images : TiledImage : NumColumns, TileOrder : )<br>把多重圖像目標拼成一個大圖像<br>7.8 tile_images_offset — Tile multiple image objects into a large image with explicit positioning information.</p>
<p>tile_images_offset(Images : TiledImage : OffsetRow, OffsetCol, Row1, Col1, Row2, Col2, Width, Height : )<br>把多重圖像目標拼成一個有確定的位置信息的大圖像<br>8.Manipulation（操作）<br>8.1 overpaint_gray — Overpaint the gray values of an image.</p>
<p>overpaint_gray(ImageDestination, ImageSource : : : )<br>重新繪製一個圖像的灰度值<br>8.2 overpaint_region — Overpaint regions in an image.</p>
<p>overpaint_region(Image, Region : : Grayval, Type : )<br>重新繪製一個圖像的區域<br>8.3 paint_gray — Paint the gray values of an image into another image.</p>
<p>paint_gray(ImageSource, ImageDestination : MixedImage : : )<br>把一個圖像的灰度值畫在另一個圖像上<br>8.4 paint_region — Paint regions into an image.</p>
<p>paint_region(Region, Image : ImageResult : Grayval, Type : )<br>把區域畫在一個圖像中<br>8.5 paint_xld — Paint XLD objects into an image.</p>
<p>paint_xld(XLD, Image : ImageResult : Grayval : )<br>把 XLD 目標化在一個圖像中<br>8.6 set_grayval — Set single gray values in an image.</p>
<p>set_grayval(Image : : Row, Column, Grayval : )<br>在一個圖像中設置一個點的灰度值<br>9.Type Conversion（類型轉換）<br>9.1 complex_to_real — Convert a complex image into two real images.</p>
<p>complex_to_real(ImageComplex : ImageReal, ImageImaginary : : )<br>把一個複數圖像轉化為兩個圖像（一個是實部，另一個是虛部，可參考 z=a+bi）<br>9.2 convert_image_type — Convert the type of an image.</p>
<p>convert_image_type(Image : ImageConverted : NewType : )<br>轉換圖像類型<br>NewType (input_control) string → (string)</p>
<p>Desired image type (i.e., type of the gray values).</p>
<p>Default value: ‘byte’</p>
<p>List of values: ‘int1’, ‘int2’, ‘uint2’, ‘int4’, ‘int8’, ‘byte’, ‘real’, ‘direction’, ‘cyclic’, ‘complex’</p>
<p>List of values (for compute devices): ‘int1’, ‘int2’, ‘uint2’, ‘int4’, ‘byte’, ‘real’, ‘direction’, ‘cyclic’, ‘complex’<br>9.3 real_to_complex — Convert two real images into a complex image.</p>
<p>real_to_complex(ImageReal, ImageImaginary : ImageComplex : : )<br>將兩個圖像（實部和虛部）轉換為一個複數圖像，complex_to_real 的逆運算<br>9.4 real_to_vector_field — Convert two real-valued images into a vector field image.</p>
<p>real_to_vector_field(Row, Col : VectorField : Type : )<br>把兩個實值圖像轉換為一個矢量域圖像<br>9.5 vector_field_to_real — Convert a vector field image into two real-valued images.</p>
<p>vector_field_to_real(VectorField : Row, Col : : )<br>real_to_vector_field 的逆運算</p>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wx.jpg" alt="tosobright WeChat Pay">
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/ali.jpg" alt="tosobright Alipay">
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>Post author:</strong>
    tosobright
  </li>
  <li class="post-copyright-link">
    <strong>Post link:</strong>
    <a href="http://www.soshare.cn/2013/04/07/130407-halcon-image/" title="Halcon算子學習——image">http://www.soshare.cn/2013/04/07/130407-halcon-image/</a>
  </li>
  <li class="post-copyright-license">
    <strong>Copyright Notice: </strong>
    All articles in this blog are licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> unless stating additionally.
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Vision/" rel="tag"><i class="fa fa-tag"></i> Vision</a>
          
            <a href="/tags/Halcon/" rel="tag"><i class="fa fa-tag"></i> Halcon</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2013/04/07/130407-image-fft-flaw/" rel="next" title="基於快速傅利葉變換的瑕疵檢測">
                <i class="fa fa-chevron-left"></i> 基於快速傅利葉變換的瑕疵檢測
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2013/04/07/130407-halcon-file/" rel="prev" title="Halcon算子學習——File">
                Halcon算子學習——File <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
      <script data-ad-client="ca-pub-3578624407535320" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="tosobright">
            
              <p class="site-author-name" itemprop="name">tosobright</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">51</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">4</span>
                  <span class="site-state-item-name">categories</span>
                
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">tags</span>
                
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/tosobright" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://gitee.com/tosobright" target="_blank" title="Gitee">
                      
                        <i class="fa fa-fw fa-git"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:tosobright@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:toso@soshare.cn" target="_blank" title="E-Mail2">
                      
                        <i class="fa fa-fw fa-envelope-square"></i></a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.soshare.cn/" title="Soshare" target="_blank">Soshare</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2010 &mdash; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">tosobright</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







  <div style>
    <script src="//s95.cnzz.com/z_stat.php?id=1726916&web_id=1726916" language="JavaScript"></script>
  </div>



        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: true,
        appId: 'TMSskYT1d5742mMn1W68iohd-gzGzoHsz',
        appKey: 'dIOnzLoKHUh71UF48oH6r0Qe',
        placeholder: 'Just go go',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("TMSskYT1d5742mMn1W68iohd-gzGzoHsz", "dIOnzLoKHUh71UF48oH6r0Qe");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  

  
  


  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=5.1.4"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=5.1.4"></script>


  

</body>
</html>
